#!/usr/bin/python
#-*- coding: utf-8 -*-

# CPBMI Python Homework 6-1
# Programmed by Seunghwan Kim

import urllib
import re
import os

f = urllib.urlopen("http://www.snubi.org/member.html")
data = f.read()

images = re.findall(r"<img.*\ssrc=\"(.*?)\"", data)

os.mkdir("member_pictures")

for image in images:
    local_filename = image.split('/')[-1]
    urllib.urlretrieve(image, 'member_pictures/' + local_filename)